<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">  
<title>专利协同服务网络平台</title>
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/select.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/H-ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/select-ui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/layer.js"></script>

<script type="text/javascript">
$(document).ready(function(e) {
    $(".select").uedSelect({
		width : 345			  
	});
});
</script>
<style type="text/css">
select{width:100px;font-size:13px;}
.formControls{margin-top:3px;font-size: 15px;}
</style>
</head>
<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">首页</a></li>
			<li><a href="#">${location}</a></li>
			<li><a href="#">查看专利交底书</a></li>
		</ul>
    </div>  
    <div class="formbody">    
		<div id="usual1" class="usual"> 
			<div class="formtitle">
	    		<span>专利交底书</span>
	    	</div>
			<div id="tab1" class="tabson">
				<ul class="seachform">
					<li>
						<label>&nbsp;&nbsp;修改记录&nbsp;:&nbsp;</label>  
						<div class="vocation" >
							<select class="select"  onchange="changeSynergy(this.value)">
								<c:forEach items="${patentApplies}" var="apply">
									<option value="${apply.id}">&nbsp;&nbsp;${fn:substring(apply.createTime,0,19)}&nbsp;修改版本</option>
								</c:forEach>
							</select>
						</div>
					</li>
				</ul>
				<div class="panel-body"  style="margin-left:-50px;width:80%;">
					<form action="" method="post" class="form form-horizontal responsive" id="form">
						<div class="row cl" >
							<label class="form-label col-xs-3">专利名称：</label>
							<div class="formControls col-xs-8">${patent.name}</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-3">所属技术领域：</label>
							<div class="formControls col-xs-8" id="techfield">
								${patentApplies[0].techfield}
							</div>
						</div>
							<div class="row cl">
							<label class="form-label col-xs-3">背景技术：</label>
							<div class="formControls col-xs-8" id="techbackground" >
								${patentApplies[0].techbackground}
							</div>
						</div>
							<div class="row cl">
							<label class="form-label col-xs-3">所要解决的技术问题：</label>
							<div class="formControls col-xs-8" id="techquestion">
								${patentApplies[0].techquestion}
							</div>
						</div>
							<div class="row cl">
							<label class="form-label col-xs-3">具体技术方案：</label>
							<div class="formControls col-xs-8" id="techmethod">
								${patentApplies[0].techmethod}
							</div>
						</div>
							<div class="row cl">
							<label class="form-label col-xs-3">与以往技术相比的有益效果：</label>
							<div class="formControls col-xs-8"  id="techeffect">
								${patentApplies[0].techeffect}
							</div>
						</div>
							<div class="row cl">
							<label class="form-label col-xs-3">附图及简要说明：</label>
							<div class="formControls col-xs-8"  id="pictexplain">
								${patentApplies[0].pictexplain}
							</div>
						</div>
						<div class="row cl" >
							<label class="form-label col-xs-3">其他附件：</label>
							<div class="formControls col-xs-8" style="font-size: 15px;"  id="downloadfilediv">
								<c:forEach items="${fn:split(patentApplies[0].uploadFileNames,',')}" var="filename" >
									<c:url value="/scienceExpert/downloadFile.do" var="downurl">
										<c:param name="filename" value="${filename}"></c:param>
									</c:url>
									<a href="${downurl}" style="font-size: 15px;" target="_blank">
										<span class="btn-upload form-group" style="font-size: 15px;">${fn:split(filename,'_')[2]}</span>
									</a><br/>
								</c:forEach>
							</div>
						</div>
						<div class="row cl">
							<div class="col-xs-8 col-xs-offset-3 " style="margin-top:30px;">
								<input type="button" onclick="history.back()"  class="scbtn" value="返回"/>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>   
	</div>
	<script type="text/javascript"> 
	 $("#usual1 ul").idTabs(); 
	 function htmlToCode(s){ 
		  if(s == null)   { 
		  	return ""; 
		  } else { 		
			  	s = s.replace("\n\r", "<br>&nbsp;&nbsp;");
		 		s = s.replace("\r\n", "<br>&nbsp;&nbsp;");
		 		s = s.replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
		        s = s.replace("\"", "\\"+"\"");
		 		return s; 
		  } 
	  }  
	  function changeSynergy(applyId){
		  $.ajax({
				type:"POST",
				dataType:"json",
				data:{"applyId":applyId},
				url:"${pageContext.request.contextPath}/scienceExpert/getPatentApplyById.do",
				success:function(data){
					$("#techfield").html(data.techfield);
					$("#techbackground").html(data.techbackground);
					$("#techquestion").html(data.techquestion);
					$("#techmethod").html(data.techmethod);
					$("#techeffect").html(data.techeffect);
					$("#pictexplain").html(data.pictexplain);
					var uploadFileNames = data.uploadFileNames;
					var fileNames = uploadFileNames.split(",");
					$("#downloadfilediv").empty();
					for (var i=0; i < fileNames.length; i++){
						var str = "<a href='${pageContext.request.contextPath}/scienceExpert/downloadFileOfApply.do"
							 +"?filename="+fileNames[i]+"' style='font-size: 15px;' target='_blank'>"
							 +"<span class='btn-upload form-group' style='font-size: 15px;'>"+fileNames[i].split("_")[2]+"</span></a><br/>"
						$("#downloadfilediv").append(htmlToCode(str.toString()));
					} 
				}
			
		 });
	  }
	</script>
</body>
</html>